package com.hutianao.gqgl.information.futuresPrice.service.impl;

import com.hutianao.gqgl.information.futuresPrice.entity.SearchPriceEntity;
import com.hutianao.gqgl.information.futuresPrice.respository.PriceDao;
import com.hutianao.gqgl.information.futuresPrice.service.PriceService;
import com.hutianao.gqgl.mybatis.entity.FuturesPriceEntity;
import com.hutianao.gqgl.mybatis.flexigrid.PaddingEntity;
import com.hutianao.gqgl.mybatis.flexigrid.PadingRstType;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;


@Service
public class PriceServiceImpl implements PriceService {
    @Resource
    private PriceDao PriceDao;

    @Override
    public PadingRstType<FuturesPriceEntity> queryPriceInfoListByPage(SearchPriceEntity search, PaddingEntity padding) {
        padding.deal(FuturesPriceEntity.class);
        PadingRstType<FuturesPriceEntity> padingRstType = new PadingRstType<>();
        padingRstType.setPage(padding.getPage());
        List<FuturesPriceEntity> list = PriceDao.queryPriceInfoListByPage(search,padding);
        padingRstType.setRawRecords(list);
        Integer total = PriceDao.queryPriceInfoTotal(search);
        padingRstType.setTotal(total);
        padingRstType.putItems();

        return padingRstType;
    }
}
